/*  MIDI functionnality
 notes: 
    - I won't instantiate a midi object per soundSpot, instead we will use a global midi object for all the spots. Hence, we need to keep track of the "previous note" for a maximum of at least 4 spots.
    - Midi will be using the Serial1 port, as well as pin 23 for controlling the midi chip 
*/

#ifndef midiCustom_h
#define midiCustom_h

#include "WProgram.h"

#define MAXNUMSPOTS 5 // we assume that the number of spots is < 5

class midiCustom {
  
  private: 
    byte previousNote[MAXNUMSPOTS]; 
    boolean previousActive;//=false;
    
  public: 
    void init();
    void midiAllSoundOff();
    void midiAllNoteOff();
    void midiPitchBend (char canal, int bend);
    void midiProgramChange (char canal, char programa);
    void midiNoteOff (char canal, char nota);
    void midiNoteOn (char canal, char nota, char velocity);
    void midiPitchBendAngle(int i, boolean active, float angle);
    void midiTouchWall(int i);
    void midiCollision(int i, float angle);
    void midiCollisionPercussion(int i);
    void midiPitchAngle(int i, boolean active, float angle);
};


//===================================================================================================
// DECLARATION of midi object as external (with scope between files):
extern midiCustom myMidi; // define as external

#endif
